home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 2
/
Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso
/
Aminet
/
dev
/
gcc
/
fd2inline.LHA
/
fd2inline
/
bin
/
auto
next >
Wrap
Text File
|
1992-03-20
|
2KB
|
64 lines
# copyright by Wolfgang Baron, freely distributable
# state: 0==ignore, 1==synopsis, 2==registers, 3== empty before proto, 4==proto
# had: encountered protos
BEGIN { state=0; obraces= 0; if ("" == stderr) stderr="/dev/stderr" }
/SYNOPSIS/ { state=1; obraces=0; had=0; maybe= ""; next }
/FUNCTION/ { state=0;
if (obraces != 0)
print "unbalanced braces in line " FNR >stderr;
else if ( 0==had )
print "maybe " maybe ;
next
}
state==1 &&
0<NF { opennow= gsub( "\(", "(" );
closenow= gsub( "\)", ")" );
obraces+= opennow - closenow;
if (!opennow && !closenow) {
if (0<had) {
print "ignore 0<had in line " FNR >stderr;
state= 0;
}
else print "continue synopis in line " FNR >stderr;
}
else {
# print "1->2 " FNR ": " $0 >stderr;
state= 2 }
if (0>obraces) {
print "synopsis has too many ')' in line " FNR >stderr;
state= 0; }
maybe= $0;
next
}
state==2 { if (0==NF) {
print "warning: registers expected in line " FNR >stderr;
state= 1 }
else if (0==obraces) state= 3;
else {
# print "2->1 in line " FNR >stderr;
state= 1; }
next }
state==3 { if (0<NF)
print "warning: empty line " FNR " expected." >stderr;
else state= 4;
next
}
state==4 &&
0<NF { opennow= gsub( "\(", "(" );
closenow= gsub( "\)", ")" );
obraces+= opennow - closenow;
gsub( "^t*", "" );
gsub( "^ *", "" );
gsub( " *$", "" );
print $0;
if ((opennow || closenow) && 0==obraces) {
# print "4->1 " FNR ": " $0 >stderr;
state=1; }
if (0>obraces) {
print "proto has too many ')' in line " FNR >stderr;
state=0;
}
had++;
}
END { print "" }